package com.ohimy.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.ohimy.entity.Product;
import com.ohimy.entity.Sort;
import com.ohimy.service.ProductService;

@Controller("diyAction")
public class DiyAction extends BaseAction {

	private static final long serialVersionUID = -1808768432161746641L;

	@Resource(name = "productService")
	private ProductService productService;

	private Sort sort;
	private List<Sort> sortList;
	private List<Product> productList;

	@Override
	public String execute() throws Exception {
		total = productService.getProductsBySortIdTotal(1);
		id = 1;
		sortList = productService.getAllSort();
		result = "diy/index.jsp";
		return "ohimy";
	}

	// ///////////////////////////////////////
	public List<Sort> getSortList() {
		return sortList;
	}

	public void setSortList(List<Sort> sortList) {
		this.sortList = sortList;
	}

	public void setProductService(ProductService productService) {
		this.productService = productService;
	}

	public List<Product> getProductList() {
		return productList;
	}

	public void setProductList(List<Product> productList) {
		this.productList = productList;
	}

	public Sort getSort() {
		return sort;
	}

	public void setSort(Sort sort) {
		this.sort = sort;
	}

}
